<!DOCTYPE html><html><head>
<title>inifile - Parsing of Windows INI files</title>
<style type="text/css"><!--
    HTML {
	background: 	#FFFFFF;
	color: 		black;
    }
    BODY {
	background: 	#FFFFFF;
	color:	 	black;
    }
    DIV.doctools {
	margin-left:	10%;
	margin-right:	10%;
    }
    DIV.doctools H1,DIV.doctools H2 {
	margin-left:	-5%;
    }
    H1, H2, H3, H4 {
	margin-top: 	1em;
	font-family:	sans-serif;
	font-size:	large;
	color:		#005A9C;
	background: 	transparent;
	text-align:		left;
    }
    H1.doctools_title {
	text-align: center;
    }
    UL,OL {
	margin-right: 0em;
	margin-top: 3pt;
	margin-bottom: 3pt;
    }
    UL LI {
	list-style: disc;
    }
    OL LI {
	list-style: decimal;
    }
    DT {
	padding-top: 	1ex;
    }
    UL.doctools_toc,UL.doctools_toc UL, UL.doctools_toc UL UL {
	font:		normal 12pt/14pt sans-serif;
	list-style:	none;
    }
    LI.doctools_section, LI.doctools_subsection {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding: 	0em;
    }
    PRE {
	display: 	block;
	font-family:	monospace;
	white-space:	pre;
	margin:		0%;
	padding-top:	0.5ex;
	padding-bottom:	0.5ex;
	padding-left:	1ex;
	padding-right:	1ex;
	width:		100%;
    }
    PRE.doctools_example {
	color: 		black;
	background: 	#f5dcb3;
	border:		1px solid black;
    }
    UL.doctools_requirements LI, UL.doctools_syntax LI {
	list-style: 	none;
	margin-left: 	0em;
	text-indent:	0em;
	padding:	0em;
    }
    DIV.doctools_synopsis {
	color: 		black;
	background: 	#80ffff;
	border:		1px solid black;
	font-family:	serif;
	margin-top: 	1em;
	margin-bottom: 	1em;
    }
    UL.doctools_syntax {
	margin-top: 	1em;
	border-top:	1px solid black;
    }
    UL.doctools_requirements {
	margin-bottom: 	1em;
	border-bottom:	1px solid black;
    }
--></style>
</head>
<!-- Generated from file 'ini.man' by tcllib/doctools with format 'html'
   -->
<!-- inifile.n
   -->
<body><hr> [
   <a href="../../../../../../../../home">Tcllib Home</a>
&#124; <a href="../../../../toc.html">Main Table Of Contents</a>
&#124; <a href="../../../toc.html">Table Of Contents</a>
&#124; <a href="../../../../index.html">Keyword Index</a>
&#124; <a href="../../../../toc0.html">Categories</a>
&#124; <a href="../../../../toc1.html">Modules</a>
&#124; <a href="../../../../toc2.html">Applications</a>
 ] <hr>
<div class="doctools">
<h1 class="doctools_title">inifile(n) 0.3.1 tcllib &quot;Parsing of Windows INI files&quot;</h1>
<div id="name" class="doctools_section"><h2><a name="name">Name</a></h2>
<p>inifile - Parsing of Windows INI files</p>
</div>
<div id="toc" class="doctools_section"><h2><a name="toc">Table Of Contents</a></h2>
<ul class="doctools_toc">
<li class="doctools_section"><a href="#toc">Table Of Contents</a></li>
<li class="doctools_section"><a href="#synopsis">Synopsis</a></li>
<li class="doctools_section"><a href="#section1">Description</a></li>
<li class="doctools_section"><a href="#section2">Bugs, Ideas, Feedback</a></li>
<li class="doctools_section"><a href="#category">Category</a></li>
</ul>
</div>
<div id="synopsis" class="doctools_section"><h2><a name="synopsis">Synopsis</a></h2>
<div class="doctools_synopsis">
<ul class="doctools_requirements">
<li>package require <b class="pkgname">Tcl 8.2</b></li>
<li>package require <b class="pkgname">inifile <span class="opt">?0.3.1?</span></b></li>
</ul>
<ul class="doctools_syntax">
<li><a href="#1"><b class="cmd">::ini::open</b> <i class="arg">file</i> <span class="opt">?<b class="option">-encoding</b> <i class="arg">encoding</i>?</span> <span class="opt">?<i class="arg">access</i>?</span></a></li>
<li><a href="#2"><b class="cmd">::ini::close</b> <i class="arg">ini</i></a></li>
<li><a href="#3"><b class="cmd">::ini::commit</b> <i class="arg">ini</i></a></li>
<li><a href="#4"><b class="cmd">::ini::revert</b> <i class="arg">ini</i></a></li>
<li><a href="#5"><b class="cmd">::ini::filename</b> <i class="arg">ini</i></a></li>
<li><a href="#6"><b class="cmd">::ini::sections</b> <i class="arg">ini</i></a></li>
<li><a href="#7"><b class="cmd">::ini::keys</b> <i class="arg">ini</i> <i class="arg">section</i></a></li>
<li><a href="#8"><b class="cmd">::ini::get</b> <i class="arg">ini</i> <i class="arg">section</i></a></li>
<li><a href="#9"><b class="cmd">::ini::exists</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></li>
<li><a href="#10"><b class="cmd">::ini::value</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></li>
<li><a href="#11"><b class="cmd">::ini::set</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <i class="arg">value</i></a></li>
<li><a href="#12"><b class="cmd">::ini::delete</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></li>
<li><a href="#13"><b class="cmd">::ini::comment</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></li>
<li><a href="#14"><b class="cmd">::ini::commentchar</b> <span class="opt">?char?</span></a></li>
</ul>
</div>
</div>
<div id="section1" class="doctools_section"><h2><a name="section1">Description</a></h2>
<p>This package provides an interface for easy manipulation of Windows INI files.</p>
<dl class="doctools_definitions">
<dt><a name="1"><b class="cmd">::ini::open</b> <i class="arg">file</i> <span class="opt">?<b class="option">-encoding</b> <i class="arg">encoding</i>?</span> <span class="opt">?<i class="arg">access</i>?</span></a></dt>
<dd><p>Opens an INI file and returns a handle that is used by other commands.
<i class="arg">access</i> is the same as the first form (non POSIX) of the <b class="const">open</b>
command, with the exception that mode <b class="const">a</b> is not supported. The
default mode is <b class="const">r+</b>.</p>
<p>The default <i class="arg">encoding</i> is the system encoding.</p></dd>
<dt><a name="2"><b class="cmd">::ini::close</b> <i class="arg">ini</i></a></dt>
<dd><p>Close the specified handle. If any changes were made and not written by
<b class="const">commit</b> they are lost.</p></dd>
<dt><a name="3"><b class="cmd">::ini::commit</b> <i class="arg">ini</i></a></dt>
<dd><p>Writes the file and all changes to disk. The sections are written in
arbitrary order. The keys in a section are written in alphabetical
order. If the ini was opened in read only mode an error will be thrown.</p></dd>
<dt><a name="4"><b class="cmd">::ini::revert</b> <i class="arg">ini</i></a></dt>
<dd><p>Rolls all changes made to the inifile object back to the last
committed state.</p></dd>
<dt><a name="5"><b class="cmd">::ini::filename</b> <i class="arg">ini</i></a></dt>
<dd><p>Returns the name of the file the <i class="arg">ini</i> object is associated with.</p></dd>
<dt><a name="6"><b class="cmd">::ini::sections</b> <i class="arg">ini</i></a></dt>
<dd><p>Returns a list of all the names of the existing sections in the file handle
specified.</p></dd>
<dt><a name="7"><b class="cmd">::ini::keys</b> <i class="arg">ini</i> <i class="arg">section</i></a></dt>
<dd><p>Returns a list of all they key names in the section and file specified.</p></dd>
<dt><a name="8"><b class="cmd">::ini::get</b> <i class="arg">ini</i> <i class="arg">section</i></a></dt>
<dd><p>Returns a list of key value pairs that exist in the section and file specified.</p></dd>
<dt><a name="9"><b class="cmd">::ini::exists</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p>Returns a boolean value indicating the existance of the specified section as a
whole or the specified key within that section.</p></dd>
<dt><a name="10"><b class="cmd">::ini::value</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <span class="opt">?<i class="arg">default</i>?</span></a></dt>
<dd><p>Returns the value of the named key and section. If specified,
the default value will be returned if the key does not exist. If the key does
not exist and no default is specified an error will be thrown.</p></dd>
<dt><a name="11"><b class="cmd">::ini::set</b> <i class="arg">ini</i> <i class="arg">section</i> <i class="arg">key</i> <i class="arg">value</i></a></dt>
<dd><p>Sets the value of the key in the specified section. If the section does not
exist then a new one is created.</p></dd>
<dt><a name="12"><b class="cmd">::ini::delete</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span></a></dt>
<dd><p>Removes the key or the entire section and all its keys. A section is not
automatically deleted when it has no remaining keys.</p></dd>
<dt><a name="13"><b class="cmd">::ini::comment</b> <i class="arg">ini</i> <i class="arg">section</i> <span class="opt">?<i class="arg">key</i>?</span> <span class="opt">?<i class="arg">text</i>?</span></a></dt>
<dd><p>Reads and modifies comments for sections and keys. To write a section comment use an
empty string for the <i class="arg">key</i>. To remove all comments use an empty string for <i class="arg">text</i>.
<i class="arg">text</i> may consist of a list of lines or one single line. Any embedded newlines in
<i class="arg">text</i> are properly handled.  Comments may be written to nonexistant
sections or keys and will not return an error. Reading a comment from a nonexistant
section or key will return an empty string.</p></dd>
<dt><a name="14"><b class="cmd">::ini::commentchar</b> <span class="opt">?char?</span></a></dt>
<dd><p>Reads and sets the comment character. Lines that begin with this character are treated as
comments. When comments are written out each line is preceded by this character. The default
is <b class="const">;</b>.</p></dd>
</dl>
</div>
<div id="section2" class="doctools_section"><h2><a name="section2">Bugs, Ideas, Feedback</a></h2>
<p>This document, and the package it describes, will undoubtedly contain
bugs and other problems.
Please report such in the category <em>inifile</em> of the
<a href="http://core.tcl.tk/tcllib/reportlist">Tcllib Trackers</a>.
Please also report any ideas for enhancements you may have for either
package and/or documentation.</p>
<p>When proposing code changes, please provide <em>unified diffs</em>,
i.e the output of <b class="const">diff -u</b>.</p>
<p>Note further that <em>attachments</em> are strongly preferred over
inlined patches. Attachments can be made by going to the <b class="const">Edit</b>
form of the ticket immediately after its creation, and then using the
left-most button in the secondary navigation bar.</p>
</div>
<div id="category" class="doctools_section"><h2><a name="category">Category</a></h2>
<p>Text processing</p>
</div>
</div></body></html>
